package string;

public class MatchesDemo {
    public static void main(String[] args) {
// [a-zA-Z0-9_]+@[A-Za-z0-9]+(\.[a-zAA-Z]+)+
        String email="chen@163.com.cn";
        String regex="[a-zA-Z0-9_]+@[A-Za-z0-9]+(\\.[a-zA-Z]+)+";
        boolean matches=email.matches(regex);
        if(matches){
            System.out.println("正则格式正确");
        }else{
            System.out.println("正则格式错误");
        }
    }
}
